package com.woniuxy.three.pms.hotel1.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.woniuxy.three.pms.bean.GuestBean;
import com.woniuxy.three.pms.bean.HotelBean;
import com.woniuxy.three.pms.hotel1.service.IHotelService;

@Controller
public class HotelController {
@Autowired
private IHotelService HotelServiceImp;
public void setHotelServiceImp(IHotelService hotelServiceImp) {
	HotelServiceImp = hotelServiceImp;
}
/**
 * 
* @Method : insertHotel
* @Description: (��ӾƵ�)
* @Author Administrator ����
* @Version 1.0
* @param @param bean
* @param @return    ����
* @return int    ��������
* @Exception
* @Date 2019��6��20��
 */
@PostMapping(value ="hotel/insert")
@ResponseBody
public boolean  insertHotel(HotelBean bean) {
	return HotelServiceImp.insertHotel(bean);
}
/**
 * 
* @Method : delHotel
* @Description: (���ݾƵ�������ɾ���Ƶ�)
* @Author Administrator ����
* @Version 1.0
* @param @param name
* @param @return    ����
* @return boolean    ��������
* @Exception
* @Date 2019��6��20��
 */
@DeleteMapping(value ="hotel/del")
@ResponseBody
public boolean  delHotel(int id) {
	return HotelServiceImp.delHotelById(id);
}
/**
 * 
* @Method : updateHotel
* @Description: (�޸ľƵ���Ϣ)
* @Author Administrator ����
* @Version 1.0
* @param @param bean
* @param @param name
* @param @return    ����
* @return boolean    ��������
* @Exception
* @Date 2019��6��20��
 */
@PutMapping(value ="/hotel/update")
@ResponseBody
public boolean  updateHotel(HotelBean bean,String hname) {
	System.out.println(bean);
	System.out.println(hname);
	return HotelServiceImp.updateHotel(bean, hname);
}
/**
 * 
* @Method : showHotel
* @Description: (ͨ����ҳ����ʾ���оƵ�)
* @Author Administrator ����
* @Version 1.0
* @param @param pageaNo
* @param @param pageSize
* @param @return    ����
* @return PageInfo<GuestBean>    ��������
* @Exception
* @Date 2019��6��20��
 */
@GetMapping(value ="/hotel/show")
@ResponseBody
public List<HotelBean> showHotel(){
	return HotelServiceImp.showHotel();
}
}
